<template>
  <div class="home">
    <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
      <van-cell-group>
        <van-cell title="单元格" value="内容" />
        <van-cell title="单元格" value="内容" />
      </van-cell-group>
      <van-button type="info" @click="toastText">信息按钮</van-button>

      <p>刷新次数: {{ count }}</p>
    </van-pull-refresh>
  </div>
</template>

<script>
// @ is an alias to /src
export default {
  name: 'Home',
  data() {
    return {
      count: 0,
      isLoading: false,
    }
  },
  methods: {
    toastText() {
      this.$toast.loading({
        duration: 2000, // 持续展示 toast
        forbidClick: true,
        message: '倒计时 3 秒',
      });
    },
    onRefresh() {
      setTimeout(() => {
        this.$toast('刷新成功');
        this.isLoading = false;
        this.count++;
      }, 1000);
    },
  }
}
</script>
